[Improvement]: Load process factories via DefaultTableRuntimeFactory#4100
Open
baiyangtx wants to merge 3 commits intoapache:masterfrom
Open
[Improvement]: Load process factories via DefaultTableRuntimeFactory#4100baiyangtx wants to merge 3 commits intoapache:masterfrom
baiyangtx wants to merge 3 commits intoapache:masterfrom
Conversation
## Summary Wire the new process plugin model into AMS so that table processes are discovered from `ProcessFactory` implementations and scheduled via the existing `ProcessService`. ## Details - Extend `DefaultTableRuntimeFactory` to implement the `TableRuntimeFactory` process APIs: - Aggregate installed `ProcessFactory` instances by `TableFormat` / `Action` and expose derived `ActionCoordinator` plugins via `supportedCoordinators()` - Merge `DefaultTableRuntime.REQUIRED_STATES` with additional states required by all process factories for the same format when building `TableRuntimeCreator` - Keep using `DefaultTableRuntime` without introducing extra runtime types - Introduce `DefaultActionCoordinator` to bridge `ProcessFactory` trigger/recover semantics to the existing scheduler: - Build trigger strategies from `ProcessFactory#triggerStrategy` - Delegate `trigger` and `recoverTableProcess` to the underlying factory - Add `TableProcessFactoryManager` as an `AbstractPluginManager<ProcessFactory>` using the `process-factories` plugin namespace - Refactor `AmoroServiceContainer` startup sequence: - Initialize `TableProcessFactoryManager` and collect all installed `ProcessFactory` instances - Initialize all `TableRuntimeFactory` plugins with the shared list of process factories - Collect all derived `ActionCoordinator`s from table runtime factories and inject them into `ProcessService` - Update `ProcessService` to accept a pre-built list of `ActionCoordinator`s while keeping the original constructors for backward compatibility and tests - Run `mvn spotless:apply` and `mvn -pl amoro-ams -am -DskipTests compile` to ensure style and compilation pass Co-Authored-By: Aime <aime@bytedance.com> Change-Id: Iaa867503c8b0bf93c2b7f0b8fe7d752e2ddbac67
…in and use default runtime ## Summary Decouple `TableRuntimeFactory` from the generic `ActivePlugin` mechanism and make `AmoroServiceContainer` explicitly use `DefaultTableRuntimeFactory` as the default implementation. ## Details - Change `TableRuntimeFactory` in `amoro-common` so it no longer extends `ActivePlugin`, keeping only process-related APIs: - `List<ActionCoordinator> supportedCoordinators()` - `void initialize(List<ProcessFactory> factories)` - `Optional<TableRuntimeCreator> accept(ServerTableIdentifier, Map<String, String>)` - Refactor `TableRuntimeFactoryManager` in AMS: - Remove inheritance from `AbstractPluginManager<TableRuntimeFactory>` to avoid the `ActivePlugin` constraint - Implement a simple manager that wraps a provided `List<TableRuntimeFactory>` - Provide a default no-arg constructor that installs a single `DefaultTableRuntimeFactory` - Keep `initialize()` as a no-op and `installedPlugins()` as the accessor to preserve existing wiring in `DefaultTableService` - Update `DefaultTableRuntimeFactory`: - Remove `@Override` annotations from `open/close/name` since they no longer implement `ActivePlugin` methods - Keep the methods as no-op helpers with the same behavior - Update `AmoroServiceContainer.startOptimizingService` to use `DefaultTableRuntimeFactory` directly: - Construct a `DefaultTableRuntimeFactory` instance explicitly - Wrap it into `TableRuntimeFactoryManager` via `Collections.singletonList(tableRuntimeFactory)` - Use the resulting singleton list as the only table runtime factory when initializing process factories and collecting `ActionCoordinator`s - Leave `DefaultTableService` logic unchanged, it still uses `TableRuntimeFactoryManager.installedPlugins()` but now operates over the explicit default factory list - Ensure `ProcessService` changes from previous step are included in this commit so the module compiles cleanly ## Verification - Ran `./mvnw -pl amoro-ams -am -DskipTests compile` from repo root - Build succeeded for the full AMS reactor - `spotless` and `checkstyle` passed with only existing warnings unrelated to this change Co-Authored-By: Aime <aime@bytedance.com> Change-Id: Ifa8deef0d2553176300cdef2c0cb073d52ee3303
… default factory ## Summary - Remove TableRuntimeFactoryManager indirection and wire DefaultTableService directly with a TableRuntimeFactory implementation. - Simplify DefaultTableRuntimeFactory after decoupling from plugin framework and ActivePlugin lifecycle. - Inline default table runtime factory wiring into AmoroServiceContainer and tests, and update process/service initialization. ## Details - DefaultTableService - Change constructor to accept a TableRuntimeFactory instead of TableRuntimeFactoryManager. - Replace iteration over installed factories with a single factory.accept(...) call when creating TableRuntime instances. - DefaultTableRuntimeFactory - Drop unused ActivePlugin-style methods: open(Map<String, String>), close(), and name(). - AmoroServiceContainer - Instantiate a single DefaultTableRuntimeFactory in startOptimizingService and pass it into DefaultTableService. - Initialize the defaultRuntimeFactory with ProcessFactory plugins and derive ActionCoordinators from it directly. - Tests - AMSServiceTestBase: construct DefaultTableService with a concrete DefaultTableRuntimeFactory instead of a mocked TableRuntimeFactoryManager. - TestDefaultTableRuntimeHandler: hold a DefaultTableRuntimeFactory field and pass it into DefaultTableService for all test setups. - Cleanup - Delete TableRuntimeFactoryManager class and remove all references and related imports across main and test code. - Fix spotless formatting violations in the touched files so that `mvn -pl amoro-ams -am -DskipTests compile` passes. Co-Authored-By: Aime <aime@bytedance.com> Change-Id: I8acca1841470dfc1bbd87b77e424a34f4d52ae82
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR is a subtask of #4100
Wire the new process plugin model(Introduced by #4097) into AMS so that table processes are discovered from
ProcessFactoryimplementations and scheduled via the existingProcessService.Details
Promote
ProcessFactoryto the single extension point for table processes.DefaultTableRuntimeFactoryaggregates allProcessFactoryimplementations, exposes derivedActionCoordinators, and merges theirrequiredStates()withDefaultTableRuntime.REQUIRED_STATES.Simplify
TableRuntimeFactoryso it only describes table runtime & process wiring.ActivePlugin; lifecycle methods (open/close/name) are removed from the interface and fromDefaultTableRuntimeFactory.Wire AMS directly to
DefaultTableRuntimeFactoryinstead of a generic plugin manager.AmoroServiceContainercreates a singleDefaultTableRuntimeFactory, passes it toDefaultTableService, then initializes it with allProcessFactoryimplementations and usessupportedCoordinators()to build the coordinator list forProcessService.DefaultTableServicenow depends on aTableRuntimeFactorydirectly and uses it to createTableRuntimeinstances.Clean up
ProcessServiceconstructors to match the new model.ActionCoordinatorManager.List<ActionCoordinator>; tests use the 2‑argument convenience overload.